package com.example.common.view

import android.content.Context
import android.util.AttributeSet
import android.view.MotionEvent
import androidx.recyclerview.widget.RecyclerView

class VideoRecycleView constructor(context: Context,attributeSet: AttributeSet):RecyclerView(context,attributeSet) {
    //是否需要拦截
    private var isInterceptor = false


    fun setInterceptor(bool:Boolean){
        isInterceptor = bool
    }
    //控制是否拦截事件
    override fun onInterceptTouchEvent(e: MotionEvent?): Boolean {
        //如果需要拦截操作,则返回true
        if(isInterceptor){
            return true
        }
        return super.onInterceptTouchEvent(e)
    }

    //分发事件(执行步骤一)
    override fun dispatchTouchEvent(ev: MotionEvent?): Boolean {
        return super.dispatchTouchEvent(ev)
    }
    //处理事件(执行步骤)
    override fun onTouchEvent(e: MotionEvent?): Boolean {
        return super.onTouchEvent(e)
    }



}